<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
<!--
Copyright 2008, 2009, 2010 Miguel Ángel Laguna Lobato

This file is part of Multiclinical Trial Web-PACS.

Multiclinical  Trial Web-PACS is free  software: you  can redistribute 
it and/or modify it under  the terms of the GNU General Public License 
as published by the Free  Software Foundation, either version 3 of the 
License, or (at your option) any later version.

Multiclinical  Trial Web-PACS is distributed  in the hope that it will 
be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
of  MERCHANTABILITY or  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
General Public License for more details.

You should have received a copy of the GNU General Public License
along with Multiclinical Trial Web-PACS.  If not, see 
<http://www.gnu.org/licenses/>. 
 -->

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:p="http://primefaces.prime.com.tr/ui">

<ui:composition template="/jsp/include/templateRsc.xhtml">
<ui:define name="cuerpo">

<!-- Comienza la página JSF -->

<div class="cuerpo">

	<t:saveState value="#{selectImages.folder}" />
	<t:saveState value="#{selectImages.thumbs}" />
	<t:saveState value="#{selectImages.imgTypes}" />

	<f:loadBundle basename="es.urjc.mctwp.resources.messages" var="msgs"/>
	
	<h:form>
	
	<table style="margin-left: auto; margin-right: auto;">
		<tr>
			<td style="background-color: gr;">
				<t:dataTable 
					id="gridThumbs" 
					newspaperColumns="3" 
					styleClass="resTabla"
					headerClass="resCabecera" 
					columnClasses="topAlignedCol"
					value="#{selectImages.thumbs}" 
					var="fimag" rows="6">
					
					<f:facet name="header">
						<h:outputText value="#{msgs['jsf.generic.Images']}" />
					</f:facet>
					<f:facet name="footer"><hr/></f:facet>
					<h:column styleClass="topAligned">
						<h:panelGrid 
							columns="1">
							<h:graphicImage 
								url="#{fimag.path}" 
								alt="#{fimag.thumbId}" 
								title="#{fimag.thumbId}"/>
							<h:panelGroup>
								<h:selectBooleanCheckbox value="#{fimag.selected}" />
								<h:outputText value="#{fimag.thumbIdShort}"/>
							</h:panelGroup>
							<h:outputText
								value="#{fimag.patNameShort}"
								rendered="#{!selectImages.containerAPatient and !selectImages.containerAStudy and !(empty fimag.patCode)}"/>
							<h:outputText
								value="#{fimag.patNameShort}"
								style="background-color: green;"
								rendered="#{(selectImages.containerAPatient and !(empty fimag.patCode) and (fimag.patCode == selectImages.patientCont.hospitalId)) or (selectImages.containerAStudy and fimag.patCode == selectImages.studyCont.patient.hospitalId)}"/>
							<h:outputText
								value="#{fimag.patNameShort}"
								style="background-color: red;"
								rendered="#{(selectImages.containerAPatient and !(empty fimag.patCode) and (fimag.patCode != selectImages.patientCont.hospitalId)) or (selectImages.containerAStudy and fimag.patCode != selectImages.studyCont.patient.hospitalId)}"/>
							<h:outputText
								value="#{fimag.stdCodeShort}"
								rendered="#{!selectImages.containerAStudy and !(empty fimag.stdCode)}"/>
							<h:outputText
								value="#{fimag.stdCodeShort}"
								style="background-color: green;"
								rendered="#{selectImages.containerAStudy and !(empty fimag.stdCode) and (fimag.stdCode == selectImages.studyCont.hospitalId) and (fimag.patCode == selectImages.studyCont.patient.hospitalId)}"/>
							<h:outputText
								value="#{fimag.stdCodeShort}"
								style="background-color: red;"
								rendered="#{selectImages.containerAStudy and !(empty fimag.stdCode) and ((fimag.stdCode != selectImages.studyCont.hospitalId) or (fimag.patCode != selectImages.studyCont.patient.hospitalId))}"/>
						</h:panelGrid>
					</h:column>
				</t:dataTable>
				
				<t:dataScroller 
					id="scrollerTable" 
					for="gridThumbs"  
					fastStep="10" 
					styleClass="scroll" 
					paginator="true" 
					paginatorMaxPages="20" 
					displayedRowsCountVar="inview"
					firstRowIndexVar="first" 
					lastRowIndexVar="last" 
					pageCountVar="pagTotal" 
					pageIndexVar="pagActual"
					rowsCountVar="rows">
			
					<f:facet name="first" >
						<t:graphicImage url="/jsp/icons/resultset_first.png" />
					</f:facet>
					<f:facet name="last">
						<t:graphicImage url="/jsp/icons/resultset_last.png" border="0" />
					</f:facet>
					<f:facet name="previous">
						<t:graphicImage url="/jsp/icons/resultset_previous.png" border="0" />
					</f:facet>
					<f:facet name="next">
						<t:graphicImage url="/jsp/icons/resultset_next.png" border="0" />
					</f:facet>
					
				</t:dataScroller> 
			</td>
			<td style="border-left: 1px solid #666464;">
				<table>
					<tr>
						<td>
							<table>
								<tr>
									<td>
										<h:outputLabel value="Image Type : " styleClass="frmLabel"/>
									</td>
									<td>
										<h:selectOneMenu id="imgTypes"  value="#{selectImages.typeSelected}" styleClass="frmSelectOne">
											<f:selectItem itemLabel="" itemValue="#{null}" />
											<f:selectItems value="#{selectImages.imgTypes}" />
										</h:selectOneMenu>
										<t:message id="imgTypesError" for="imgTypes" />	
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td style="float: right;">
							<table>
								<tr>
									<td>
										<h:commandButton 
											id="delete" 
											styleClass="frmButton" 
											value="#{msgs['jsf.actions.Delete']}" 
											action="#{selectImages.deleteImages}"/>
									</td>
									<td>
										<h:commandButton 
											id="importar" 
											styleClass="frmButton" 
											value="#{msgs['jsf.actions.Import']}" 
											action="#{selectImages.importImages}"/>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	
	</h:form>
		
</div>
			
<!-- Termina la página JSF -->

</ui:define>
</ui:composition>

</html>